package com.example.barcodeapp.ui.home.fragment;

import android.util.Log;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.barcodeapp.R;
import com.example.barcodeapp.base.BaseFragment;
import com.example.barcodeapp.common.Constants;
import com.example.barcodeapp.interfaces.IBasePersenter;
import com.example.barcodeapp.interfaces.own.IOwn;
import com.example.barcodeapp.persenter.own.OnePresenterjiaoshijiemian;
import com.example.barcodeapp.ui.home.JiaoshiAdapter;
import com.example.barcodeapp.ui.home.bean.JiaoShiNeiRongBean;
import com.example.barcodeapp.ui.own.bean.LanMuBean;

import butterknife.BindView;

public class JiaoshiFragment extends BaseFragment<IOwn.Persenterjiaoshi> implements IOwn.Viewjiaoshi {
    @BindView(R.id.jiaoshi_rv)
    RecyclerView jiaoshiRv;

    @Override
    protected int getLayout() {
        return R.layout.jiaoshifragment;
    }

    @Override
    protected void initView() {



//        LinearLayoutManager manager3 = new LinearLayoutManager(context);
//        jiaoshiRv.setLayoutManager(manager3);
//        jiaoshiRv.setAdapter(jiaoshiAdapter);
//        jiaoshiAdapter.notifyDataSetChanged();
    }

    @Override
    protected OnePresenterjiaoshijiemian initPersenter() {
        return new OnePresenterjiaoshijiemian();
    }


    @Override
    protected void initData() {
        Log.e("dawdawdasda", "initData: "+Constants.jiasohilanmuid );
        persenter.getjiaoshineirong( Constants.jiasohilanmuid,2);
    }

    @Override
    public void getjiaoshineirong(JiaoShiNeiRongBean xiLieKeBean) {
        GridLayoutManager manager = new GridLayoutManager(getActivity(),2);
        JiaoshiAdapter jiaoshiAdapter = new JiaoshiAdapter(getActivity(),xiLieKeBean.getData());
        jiaoshiRv.setLayoutManager(manager);
        jiaoshiRv.setAdapter(jiaoshiAdapter);
        jiaoshiAdapter.notifyDataSetChanged();
    }

    @Override
    public void getjiaoshineironglanmu(LanMuBean xiLieKeBean) {

    }
}
